#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N = 20010;
int h[N];
ll sum, cnt;
bool cmp(int x, int y)
{
	return x > y;
}
int main()
{
	ll n, b;
	cin >> n >> b;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	
	sort(h, h + n, cmp);

	int k = 0;
	while (sum < b)
	{
		sum += h[k];
		k++;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}